package com.itheima.Jiuye12;

import java.io.*;
import java.util.Arrays;

//1. 已知文件的内容为 999 123 321 1234567 888
//要求使用程序将文件的内容改成  123 321 888 999 1234567
public class Zuoye1 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("mJiuYe\\a.txt"));
        String s = br.readLine();  //整行读取readLine
        String[] s1 = s.split(" ");
        int[] a = new int[s1.length];
        for (int i = 0; i < s1.length; i++) {
            a[i] = Integer.parseInt(s1[i]);
        }
        br.close();
        Arrays.sort(a);
        BufferedWriter bw = new BufferedWriter(new FileWriter("mJiuYe\\b.txt"));
        for (int i = 0; i < a.length; i++) {
            bw.write(a[i]+" ");
            bw.flush();      //刷新
        }
        bw.close();         //关闭流
    }
}
